import java.util.ArrayList;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Iterator;

public class IteratorTest {
    public static void main(String[] args) {
        Collection coll = new ArrayList();
        coll.add("vegeta");
        coll.add("chenzi");
        coll.add("k10000");

        //while方式的Iterator迭代器
        //Iterator it = coll.iterator();
        //while (it.hasNext()){
            //System.out.println(it.next());
        //}

        //for方式的Iterator迭代器
        for (Iterator it = coll.iterator();it.hasNext();){
            System.out.println(it.next());
        }
    }
}
